#!/usr/bin/env python
#
# Start up the Bed Monitor user interface.

import Tkinter
from Tkinter import Tk
import monitor.ui
from monitor.ui import VitalSignsUI
import threading
import argparse

if __name__ == '__main__':

	parser = argparse.ArgumentParser(description="Start the Bed Monitor UI.")
	parser.add_argument("bed_id", type=str, help="Bed subsystem identifier")
	parser.add_argument("port", type=int, help="Beginning of port range to be used for this bed")
	args = parser.parse_args()

	root = Tk()
	app = VitalSignsUI(root, args.bed_id)
	app.addListener(args.port + 2)
	app.addListener(args.port + 3)
	app.addConnector(args.port + 4)

	root.title("Bedside Monitor")
	root.bind('<Return>', root.quit)
	app.start()
	root.mainloop()

